I collect data at Fort Campbell, KY. Fort Campbell is in KY, but it also part of it is also TN. Fort Campbell is a military installation where there is approximately 105,000 acres of land with varying environments that include forests consisting of primarily deciduous trees, grasslands, wetlands, and agricultural fields. There are approximately 453 miles of streams scattered throughout the base.
Let’s import my static maps created from Google Earth Engine!
tmax <- rast("tmax.tif")
prcp <- rast("prcp.tif")
vp <- rast("vp.tif")
# load in fc data
mil <- st_read("tl_2022_us_mil.shp")
## Reading layer `tl_2022_us_mil' from data source
## `C:\Users\gtomboc\OneDrive - Austin Peay State University\masters\data_analytics\basics_mapping\tl_2022_us_mil.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 858 features and 8 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -159.7881 ymin: 13.30706 xmax: 174.156 ymax: 64.87795
## Geodetic CRS: NAD83
fc <- mil[mil$FULLNAME == "Ft Campbell" | grepl("Campbell", mil$FULLNAME), ]
fc <- st_transform(fc, crs = "EPSG:4326")
fc_vect <- vect(fc)
tmax_fc <- mask(crop(tmax, fc_vect), fc_vect)
tmax_fc <- mask(tmax_fc, fc_vect, inverse = FALSE)
prcp_fc <- mask(crop(prcp, fc_vect), fc_vect)
prcp_fc <- mask(prcp_fc, fc_vect, inverse = FALSE)
vp_fc <- mask(crop(vp, fc_vect), fc_vect)
vp_fc <- mask(vp_fc, fc_vect, inverse = FALSE)
#ggplots
tmax_df <- as.data.frame(tmax_fc, xy = TRUE, na.rm = TRUE)
prcp_df <- as.data.frame(prcp_fc, xy = TRUE, na.rm = TRUE)
vp_df <- as.data.frame(vp_fc, xy = TRUE, na.rm = TRUE)
This is a static map that shows the maximum temperature from July 1, 2024 - July 9, 2024. The highest average temperature throughout this week is taking place right outside of the urbanization of Fort Campbell.
#max temp static map
ggplot() +
geom_raster(data = tmax_df, aes(x = x, y = y, fill = tmax), interpolate = FALSE) +
geom_sf(data = fc, fill = NA, color = "black", linewidth = 1) +
coord_sf(xlim = c(st_bbox(fc)["xmin"], st_bbox(fc)["xmax"]),
ylim = c(st_bbox(fc)["ymin"], st_bbox(fc)["ymax"]),
expand = FALSE) +
scale_fill_gradientn(colors = hcl.colors(100, "RdYlBu", rev = TRUE),
name = "°C") +
labs(title = "Maximum Temperature (July 2024)",
x = "Longitude", y = "Latitude") +
theme(
panel.background = element_blank(),
panel.grid = element_blank(),
panel.border = element_rect(color = "black",
fill = NA, size = 1))
This is a static map of the average precipitation through out that week. The most precipitation occurred in the North West side of Fort Campbell.
#precipitation static map
ggplot() +
geom_raster(data = prcp_df, aes(x = x, y = y, fill = prcp), interpolate = FALSE) +
geom_sf(data = fc, fill = NA, color = "black", linewidth = 1) +
coord_sf(xlim = c(st_bbox(fc)["xmin"], st_bbox(fc)["xmax"]),
ylim = c(st_bbox(fc)["ymin"], st_bbox(fc)["ymax"]),
expand = FALSE) +
scale_fill_gradientn(colors = hcl.colors(100, "Blues", rev = TRUE)) +
labs(title = "Precipitation (July 2024)",
x = "Longitude", y = "Latitude") +
theme(
panel.background = element_blank(),
panel.grid = element_blank(),
panel.border = element_rect(color = "black",
fill = NA, size = 1))
This is a static map of vapor pressure through out the week. As you can see, there is a better distribution of vapor pressure throughout Fort Campbell itself.
#vapor pressure static map
ggplot() +
geom_raster(data = vp_df, aes(x = x, y = y, fill = vp), interpolate = FALSE) +
geom_sf(data = fc, fill = NA, color = "black", linewidth = 1) +
coord_sf(xlim = c(st_bbox(fc)["xmin"], st_bbox(fc)["xmax"]),
ylim = c(st_bbox(fc)["ymin"], st_bbox(fc)["ymax"]),
expand = FALSE) +
scale_fill_gradientn(colors = hcl.colors(100, "YlOrRd", rev = TRUE)) +
labs(title = "Vapor Pressure (July 2024)",
x = "Longitude", y = "Latitude") +
theme(
panel.background = element_blank(),
panel.grid = element_blank(),
panel.border = element_rect(color = "black",
fill = NA, size = 1))
Let’s look at a map of Kentucky and Tennessee to get an idea of my study area!
#Create map
ggplot() +
#states surrounding
geom_polygon(
data = state %>% filter(region %in% border_states),
aes(x = long, y = lat, group = group),
fill = "snow2", color = "black") +
#ky + tn with ALL counties
geom_polygon(data = ky_tn,
aes(x = long, y = lat, group = group),
fill = "azure", color = "black") +
#highlight the counties i use
geom_polygon(data = counties,
aes(x = long, y = lat, group = group),
fill = "darkgrey", color = "black") +
#put fort campbell (palmyra rd as a point)
geom_point(data = fort_campbell,
aes(x = x, y = y),
color = "red",
size = 2,
stroke = 1) +
coord_fixed(xlim = c(-90, -82), ylim = c(33.5, 39)) +
scale_x_continuous(breaks = seq(-91, -83, by = 1)) +
scale_y_continuous(breaks = seq(34, 39, by = 1)) +
xlab("Longitude") + ylab("Latitude") + ggtitle("Fort Campbell Study Area") +
theme_classic() +
theme(
panel.grid = element_blank()
) +
annotation_scale(
location = "tl",
width_hint = 0.3,
style = "ticks",
text_cex = 0.8
) +
annotation_north_arrow(
location = "bl",
which_north = "true",
style = north_arrow_nautical(),
height = unit(0.8, "cm"),
width = unit(0.8, "cm")
)
## Using plotunit = 'm'
## Warning in draw_panel(...): True north is not meaningful without coord_sf()
Now, let’s view the sites where I caught red bats! Yippe!!!
sites <- read.csv("netting_sites_2025.csv")
#make a interactive map
sites$Color <- c("hotpink", "darkblue", "purple", "green", "yellow", "brown", "orange", "black")
leaflet(data = sites) %>%
addProviderTiles(providers$OpenStreetMap, group = "Satellite") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "Road Map") %>%
addProviderTiles(providers$Esri.WorldTopoMap, group = "Terrain") %>%
addCircleMarkers(
lng = ~ Longitude,
lat = ~Latitude,
color = ~Color,
fillColor =~Color,
fillOpacity =~ 0.8,
popup = ~paste("Latitude:", Latitude, "<br>Longitude:", Longitude)
)%>%
fitBounds(~min(Longitude), ~min(Latitude), ~max(Longitude), ~max(Latitude)) %>%
addLayersControl(
baseGroups = c("Road Map", "Satellite", "Terrain"),
options = layersControlOptions(collapsed = FALSE)
)%>%
addScaleBar(position = "bottomleft") %>%
addLayersControl(
baseGroups = c("Road Map", "Satellite", "Terrain"),
options = layersControlOptions(collapsed = FALSE)
)
The red outline indicates the entirety of Fort Campbell. The sites are differentiated by color.
library(knitr)
##
## Attaching package: 'knitr'
## The following object is masked from 'package:terra':
##
## spin
kable(sites[, c("Sites", "Latitude", "Longitude", "Color")],
col.names = c("Site", "Latitude", "Longitude", "Color"),
)
| Site | Latitude | Longitude | Color |
|---|---|---|---|
| 23 | 36.61840 | -87.61080 | hotpink |
| 109 | 36.58150 | -87.63680 | darkblue |
| 324 | 36.56588 | -87.51125 | purple |
| 113 | 36.60190 | -87.56640 | green |
| 4 | 36.57450 | -87.51200 | yellow |
| 6 | 36.65740 | -87.77370 | brown |
| 116 | 36.62240 | -87.77920 | orange |
| 2 | 36.66480 | -87.78880 | black |
sites <- read.csv("netting_sites_2025.csv")
#make images for markers
sites_markers <-
c("red_01.PNG",
"red_02.PNG",
"red_03.PNG",
"red_04.PNG",
"red_05.PNG",
"red_06.PNG",
"red_07.PNG",
"red_08.PNG"
)
site_icon <- makeIcon(sites_markers, iconWidth = 35, iconHeight = 35)
#make a interactive map
sites$Color <- c("hotpink", "darkblue", "purple", "green", "yellow", "brown", "orange", "black")
leaflet(data = sites) %>%
addProviderTiles(providers$OpenStreetMap, group = "Satellite") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "Road Map") %>%
addProviderTiles(providers$Esri.WorldTopoMap, group = "Terrain") %>%
addMarkers(
lng = ~ Longitude,
lat = ~Latitude,
icon = site_icon,
popup = ~paste("Latitude:", Latitude, "<br>Longitude:", Longitude)
) %>%
fitBounds(~min(Longitude), ~min(Latitude), ~max(Longitude), ~max(Latitude)) %>%
addLayersControl(
baseGroups = c("Satellite"),
options = layersControlOptions(collapsed = FALSE)
)%>%
fitBounds(~min(Longitude), ~min(Latitude), ~max(Longitude), ~max(Latitude)) %>%
addLayersControl(
baseGroups = c("Road Map", "Satellite", "Terrain"),
options = layersControlOptions(collapsed = FALSE)
)%>%
addScaleBar(position = "bottomleft") %>%
addLayersControl(
baseGroups = c("Road Map", "Satellite", "Terrain"),
options = layersControlOptions(collapsed = FALSE)
)